package com.blog4j.user.controller;

import com.blog4j.common.model.Result;
import com.blog4j.user.service.FansService;
import com.blog4j.user.vo.req.FansListReqVo;
import com.blog4j.user.vo.resp.FansRespVo;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author 98k灬
 * @version v1.0.0
 * @Description : 功能描述
 * @Create on : 2024/8/1 13:35
 **/
@RequestMapping("/fans")
@RestController
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class FansController {
    private final FansService fansService;

    /**
     * 根据用户ID获取用户的粉丝信息列表
     *
     * @param reqVo 请求信息
     * @return 用户的粉丝信息列表
     */
    @PostMapping("/list")
    public Result list(@RequestBody @Valid FansListReqVo reqVo) {
        PageInfo<FansRespVo> pageInfo = fansService.pageList(reqVo);
        return Result.ok(pageInfo);
    }
}
